//
//  NKDetailsTableViewCell.m
//  NewKY
//
//  Created by admin on 16/11/15.
//  Copyright © 2016年 Dee. All rights reserved.
//

#import "NKDetailsTableViewCell.h"
#import <UIImageView+WebCache.h>
#import "CZAdditions.h"


@interface NKDetailsTableViewCell ()

 /*---- 头像 -----*/
@property (weak, nonatomic) IBOutlet UIImageView *iconImageView;
 /*---- 医生姓名 -----*/
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
 /*---- 性别 -----*/
@property (weak, nonatomic) IBOutlet UILabel *sexLabel;
 /*---- 医院名字 -----*/
@property (weak, nonatomic) IBOutlet UILabel *hospitalLabel;
 /*---- 预约数 -----*/
@property (weak, nonatomic) IBOutlet UILabel *appointmentCountLabel;
 /*---- 推荐指数的View -----*/
@property (weak, nonatomic) IBOutlet UIView *recommendView;

 /*---- 推荐指数的label -----*/
@property (weak, nonatomic) IBOutlet UILabel *recommendLabel;

@end


@implementation NKDetailsTableViewCell


-(void)setDetailsModel:(NKDetailsModel *)detailsModel{
    
    _detailsModel = detailsModel;
    
    self.nameLabel.text = detailsModel.doctor_name;
    self.sexLabel.text = [NSString stringWithFormat:@"性别:%@", detailsModel.doctor_gender == 0 ? @"女" : @"男"];
    self.hospitalLabel.text = detailsModel.doctor_hospital_name;
    
    self.appointmentCountLabel.text = [NSString stringWithFormat:@"预约数:%@",detailsModel.operation_count];

    if ([self.sexLabel.text  isEqual: @"男"]) {

        [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:detailsModel.doctor_portrait] placeholderImage:[UIImage imageNamed:@"doctor_defaultphoto_male"]];
    }else{
        [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:detailsModel.doctor_portrait] placeholderImage:[UIImage imageNamed:@"doctor_defaultphoto_female"]];
    }
    
    self.iconImageView.contentMode = UIViewContentModeScaleAspectFill;
    
    self.iconImageView.layer.cornerRadius = 32;
    self.iconImageView.layer.masksToBounds = YES;
}

 /*---- 当cell 被点击时,修改UIView 的颜色 -----*/
-(void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated{
    
    [super setHighlighted:highlighted animated:animated];
    
    self.recommendView.backgroundColor = [UIColor cz_colorWithHex:0x51B4B1];
    self.recommendLabel.backgroundColor = [UIColor whiteColor];
}

-(void)setSelected:(BOOL)selected animated:(BOOL)animated{
    [super setSelected:selected animated:animated];
    self.recommendView.backgroundColor = [UIColor cz_colorWithHex:0x51B4B1];
    self.recommendLabel.backgroundColor = [UIColor whiteColor];
    
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}


@end
